From 3cd0ba42d51b8bb2b8e534b52c7d8f10e1676868 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 20 Apr 2010 14:32:53 +0100 Subject: [PATCH] tasklet: Add lock-free exit path from do_tasklet() when no work to do. Signed-off-by: Keir Fraser --- xen/common/tasklet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c index 05665ebc5d..e2109770ad 100644 --- a/xen/common/tasklet.c +++ b/xen/common/tasklet.c @@ -60,9 +60,12 @@ void do_tasklet(void) struct list_head *list = &per_cpu(tasklet_list, cpu); struct tasklet *t; + if ( likely(list_empty(list)) ) + return; + spin_lock_irq(&tasklet_lock); - if ( list_empty(list) ) + if ( unlikely(list_empty(list)) ) { spin_unlock_irq(&tasklet_lock); return; -- 2.30.2